import request from '@/utils/request'

export function getCategoryByPage(data) {
  return request({
    url: '/category',
    params: { ...data }
  })
}

export function getCategoryById(id) {
  return request({
    url: `/category/${id}`,
  })
}


export function addCategory(data) {
  return request({
    url: '/category',
    method: 'post',
    data: data
  })
}

export function updateCategoryById(data) {
  return request({
    url: `/category`,
    method: 'put',
    data: data
  })
}

export function deleteCategory(id) {
  return request({
    url: `/category/${id}`,
    method: 'delete',
  })
}

export function batchDeleteCategory(idList) {
  return request({
    url: `/category/batchDelete`,
    method: 'post',
    data: idList
  })
}

export function getMyCategory(data) {
  return request({
    url: `/category/getMyCategory`,
    params: { ...data }
  })
}